<!-- Dusan Milic -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="favicon.ico">
<title>Profil Korisnika</title>
<script language="javascript">
function popuni() {
	document.info.imeprezime.value=whatever;
	
	
	<?php 
			include("konekcija_sa_bazom.php");
		   $id=$_GET["id"];
           $query = "SELECT * FROM korisnik WHERE idKorisnik =$id";
		   $result = mysql_query($query);
		   $row = mysql_fetch_array($result);
		   ?>
		   var whatever = '<?php echo($row[3]); ?>';
		   document.info.imeprezime.value=whatever;
		   var whatever = '<?php echo($row[1]); ?>';
		   document.info.mail.value=whatever;
		   var whatever = '<?php echo($row[5]); ?>';
		   document.info.idSlike.value=whatever;
		
		   <?php 
           $query = "SELECT * FROM posetilac WHERE idKorisnik =$id";
		   $result = mysql_query($query);
		   $row = mysql_fetch_array($result);
		   ?>
		   var whatever = '<?php echo($row[2]); ?>';
		   document.info.prezentacija.value=whatever;
		   var whatever = '<?php echo($row[3]); ?>';
		   document.info.datum.value=whatever;
		   
		   
		   
		   
}
function izmeni()
{
	document.info.sacuvaj.style.visibility="visible";
	document.info.IZMENI.style.visibility="hidden";
	document.info.imeprezime.readOnly=false;
	document.info.mail.readOnly=false;
	document.info.prezentacija.readOnly=false;
	document.info.datum.readOnly=false;
}

function save(){
	
	document.info.sacuvaj.style.visibility="hidden";
	document.info.IZMENI.style.visibility="visible";
	document.info.imeprezime.readOnly=true;
	document.info.mail.readOnly=true;
	document.info.prezentacija.readOnly=true;
	document.info.datum.readOnly=true;
	
}

</script>

<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>

<body onload="popuni()">

<div id="wrapper">
   <?php
       session_start();
   include("insert/head.php"); ?>
	

    
    
    <div id="content">
    
   	  <form enctype="multipart/form-data" name="info" method="post" action="salji_bazi3.php">
    	<div id="content-main" style="/* [disabled]height:700px; */">
            <h1>PROFIL</h1>
         <table width="500" border="0" cellspacing="1" cellpadding="1" align="center" bgcolor="#FFCC99">
         <th colspan="3">Podaci</th>
   <tr > 
           <td width="20%">Ime :</td>
           <td><input name="imeprezime" type="text" size="30" readonly="readonly"></td>
           <td colspan="4">&nbsp;</td>
           </tr>
              <tr> 
           <td width="20%">Mail :</td>
           <td><input name="mail" type="text" size="30" readonly="readonly"></td>
           <td colspan="4">&nbsp;</td>
           </tr>
              
           <tr> 
           <td width="30%">Datum Rodjenja :</td>
           <td><input name="datum" type="text" size="30" readonly="readonly"></td>
           <td colspan="4">&nbsp;</td>
           </tr>
            <tr> 
           <td width="30%">Veb Prezentacija :</td>
           <td><input name="prezentacija" type="text" size="30" readonly="readonly"></td>
           <td colspan="4">&nbsp;</td>
           </tr>


         </table>
         
         <input name="id" type="text" size="30" readonly="readonly" style="visibility:hidden;" value='<?php echo($_GET["id"]); ?>'>
         <input name="idSlike" type="text" size="30" readonly="readonly" style="visibility:hidden;" />
         <?php
		 $id=$_GET["id"];
		
		  $tekId=$_SESSION["id"];
		  if($id==$tekId)
		  echo' <br/><input class="button"  name="IZMENI"  type="button" value="Izmeni" onclick="izmeni()" />';
		  else echo' <br/><input class="button"  name="IZMENI" style="visibility:hidden;"  type="button" value="Izmeni" onclick="izmeni()" />';
		  
		 ?>
         
 
         <input class="button"  name="sacuvaj" style="visibility:hidden;" type="submit"  id="23" value="Sacuvaj" />
          <br/>
          <h2>Pokloni </h2>
          
		  <?php include("konekcija_sa_bazom.php");
		  $id=$_GET["id"];
           $query = "SELECT * FROM poklon WHERE idKorisnik =$id";
		   $result = mysql_query($query);
		   $numResults = mysql_num_rows($result);
		   echo '<div class="dashes"></div>';
	
	$iter = 10;
	while (($row = mysql_fetch_array($result)) && $iter < 20) {
		
		echo '<a class="scroll-elem-box" style="width:130px; height: 170px; overflow:hidden" href="ProfilPoklona.php?id='.$row[0].'">';
		
		echo '<img src="phpscripts/prikazisliku.php?id='. $row["idSlika"]. '" style="max-height: 130px; max-width: 130px" />';
		echo '<br/>';
		if (isset($row["naziv"])) echo $row["naziv"];
		else echo $row["ime"];
		echo '</a>';
		
		$iter--;
	}
		   ?>
          
         
        
        
        
        	     	
        </div> 
                <ul id="content-side">
        <li style="height:200px">
        	<div class="dashes-top"></div>
            <div class="dashes-bottom"></div>
        	<h2> Slike </h2>
        	<blockquote>
        	  <p><br/>
				
        	    
        	    <img src="phpscripts/prikazisliku.php?id=<?php echo($_GET["id"]); ?>" style="max-height: 130px; max-width: 130px" />
      	    </p>
               <br/><br/>    
      	  </blockquote>
        	<input type="hidden" name="MAX_FILE_SIZE" value="64000" />
                                <label for="file">Одабери слику:</label>
                                <input id="userfile" type="file" name="userfile" />
                                <input name="upload" type="submit" class="box" id="upload" value=" Ubaci ">
                           
                             
                             
                                    
                                <br/><br/>     <br/><br/>
		
          </li>
           
 
        </form>      
        
    
</div>

</body>
</html> 